/**
 * Copyright (C)  2011-2011  Jesse Meng (pingf0@gmail.com).
 *
 * This file is part of OOC-GCC.
 *
 * OOC-GCC is free software: you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as published
 * by the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library. If not, see
 * <http://www.gnu.org/licenses/>.
 */

/*
 * test.c
 *
 *  Created on: 2011-4-26
 *      Author: Jesse Meng
 */

#include "OOStd.h"

void test2(){
	Exception *e=GET_EXCEPTION(1);
	TRY
		THROW(e);
	END_TRY
}
void test(){
    Exception e={"exception test2 has been changed!"};
    SET_EXCEPTION(1,&e);
    TRY
        test2();
    CATCH(&e)
        fprintf(stderr,"!!! exception : %s\n",e.reason);
    END_TRY
}
int main (int argc, char *argv[]){
    Exception excp[32]={
    		{"test1"},
    		{"test2"},
    		{"test3"},
    };

    SET_EXCEPTIONS(&excp,32);
    TRY
        test();
    FINALLY
    	fprintf(stderr,"final process\n");
    END_TRY

    return(0);
}

